<nz-breadcrumb class="breadcrumb-pos">
  <i nz-icon type="link" theme="outline" style="color:#1890FF;padding-right:4px"></i>
  <nz-breadcrumb-item>
    <a routerLink="/main/printer">打印机</a>
  </nz-breadcrumb-item>
  <nz-breadcrumb-item>
    添加打印机
  </nz-breadcrumb-item>
</nz-breadcrumb>
<div class="form-div">
    <form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">设备名称</nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <input type="text" nz-input formControlName="name" placeholder="请输入设备名称">
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('name').dirty && validateForm.get('name').errors">请输入标识名称!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="brand">选择品牌</nz-form-label>
        <nz-form-control [nzSm]="14" [nzXs]="24">
          <nz-input-group>
              <nz-select formControlName="brand" #brand (ngModelChange)="getTypecode(brand)"  style="width: 100%;">
                <nz-option *ngFor="let data of brandlist" nzLabel="{{data.name}}" nzValue="{{data.id}}"></nz-option>
              </nz-select>
          </nz-input-group>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('brand').dirty && validateForm.get('brand').errors">请选择打印机品牌!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="typecode">选择型号</nz-form-label>
        <nz-form-control [nzSm]="14" [nzXs]="24">
          <nz-input-group>
              <nz-select formControlName="typecode" #typecode (ngModelChange)="getTypelabel(typecode)" style="width: 100%;">
                <nz-option *ngIf="tips!==1" nzLabel="请先选择打印机品牌" [nzDisabled]></nz-option>  
                <nz-option  *ngFor="let data of typelist" nzLabel="{{data.codes}}" nzValue="{{data.id}}"></nz-option>
              </nz-select>
          </nz-input-group>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('typecode').dirty && validateForm.get('typecode').errors">请选择打印机型号!</nz-form-explain>
          <nz-form-extra>以下墨量是根据打印机型号的默认墨容量填入的，可修改</nz-form-extra>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="ksum">黑色容量</nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-input-number style="width:100%;" [nzMin]="0" [nzPrecision]="0.1" formControlName="ksum" [nzPlaceHolder]="'请输入黑色容量'"></nz-input-number>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('ksum').dirty && validateForm.get('ksum').errors">请输入黑色容量!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="csum">青色容量</nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-input-number style="width:100%;" [nzMin]="0" [nzPrecision]="0.1" formControlName="csum" [nzPlaceHolder]="'请输入青色容量'"></nz-input-number>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('csum').dirty && validateForm.get('csum').errors">请输入青色容量!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="msum">红色容量</nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-input-number style="width:100%;" [nzMin]="0" [nzPrecision]="0.1" formControlName="msum" [nzPlaceHolder]="'请输入红色容量'"></nz-input-number>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('msum').dirty && validateForm.get('msum').errors">请输入红色容量!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="ysum">黄色容量</nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-input-number style="width:100%;" [nzMin]="0" [nzPrecision]="0.1" formControlName="ysum" [nzPlaceHolder]="'请输入黄色容量'"></nz-input-number>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('ysum').dirty && validateForm.get('ysum').errors">请输入黄色容量!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="kWarning">
          <span>
            黑色预警值
            <i nz-icon nz-tooltip nzTitle="默认预警值，可修改" type="question-circle" theme="outline"></i>
          </span>
        </nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-input-number style="width:100%;" [nzMin]="0" [nzMax]="100" [nzPrecision]="0.1" [nzFormatter]="formatterPercent" [nzParser]="parserPercent" formControlName="kWarning" [nzPlaceHolder]="'请输入黑色预警值'"></nz-input-number>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('kWarning').dirty && validateForm.get('kWarning').errors">请输入黑色预警值!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>
  
      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="cWarning">青色预警值</nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-input-number style="width:100%;" [nzMin]="0" [nzMax]="100" [nzPrecision]="0.1" [nzFormatter]="formatterPercent" [nzParser]="parserPercent" nz-input formControlName="cWarning" [nzPlaceHolder]="'请输入青色预警值'"></nz-input-number>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('cWarning').dirty && validateForm.get('cWarning').errors">请输入青色预警值!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>
  
      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="mWarning">红色预警值</nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-input-number style="width:100%;" [nzMin]="0" [nzMax]="100" [nzPrecision]="0.1" [nzFormatter]="formatterPercent" [nzParser]="parserPercent" formControlName="mWarning" [nzPlaceHolder]="'请输入红色预警值'"></nz-input-number>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('mWarning').dirty && validateForm.get('mWarning').errors">请输入红色预警值!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>
  
      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="yWarning">黄色预警值</nz-form-label>
          <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-input-number style="width:100%;" [nzMin]="0" [nzMax]="100" [nzPrecision]="0.1" [nzFormatter]="formatterPercent" [nzParser]="parserPercent" formControlName="yWarning" [nzPlaceHolder]="'请输入黄色预警值'"></nz-input-number>
          <nz-form-explain class="checkResult" *ngIf="validateForm.get('yWarning').dirty && validateForm.get('yWarning').errors">请输入黄色预警值!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>  

      <nz-form-item nz-row style="margin-bottom:8px;">
        <nz-form-control [nzSpan]="14" [nzOffset]="6" style="text-align:center;">
          <button nz-button nzType="primary" [nzLoading]="btn_loading" (click)="addprinter()" style="margin-right:100px;">添加</button>
          <button nz-button nzType="primary" (click)="backPrevent()" routerLink="/main/printer">返回</button>
        </nz-form-control>
      </nz-form-item>
    </form>
  </div>
